package org.jeecg.talentCooperation.talent.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.talentCooperation.talent.entity.TalentBasic;
import org.jeecg.talentCooperation.talent.entity.TalentFieldRel;
import org.jeecg.talentCooperation.talent.mapper.TalentBasicMapper;
import org.jeecg.talentCooperation.talent.mapper.TalentFieldRelMapper;
import org.jeecg.talentCooperation.talent.service.ITalentFieldRelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TalentFieldRelServiceImpl extends ServiceImpl<TalentFieldRelMapper, TalentFieldRel> implements ITalentFieldRelService {

    @Autowired
    TalentFieldRelMapper talentFieldRelMapper;
    @Autowired
    TalentBasicMapper talentBasicMapper;

    @Override
    public TalentFieldRel getByTalentId(String talentId) {

        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("talent_id", talentId);
        TalentFieldRel talentFieldRel = talentFieldRelMapper.selectOne(queryWrapper);

        TalentBasic talentBasic = talentBasicMapper.selectById(talentId);
        talentFieldRel.setTitleLevel(talentBasic.getTitleLevel());
        talentFieldRel.setGender(talentBasic.getGender());
        talentFieldRel.setIdNum(talentBasic.getIdNum());
        talentFieldRel.setResearchDomain(talentBasic.getResearchDomain());
        talentFieldRel.setTheTitle(talentBasic.getTheTitle());
        talentFieldRel.setMail(talentBasic.getMail());
        talentFieldRel.setNationality(talentBasic.getNationality());
        talentFieldRel.setPoliticsStatus(talentBasic.getPoliticsStatus());
        talentFieldRel.setTalentRealName(talentBasic.getRealName());
        talentFieldRel.setTalentAllPhoneNumber(talentBasic.getAllPhoneNumber());
        talentFieldRel.setTalentPartPhoneNumber(talentBasic.getPartPhoneNumber());
        talentFieldRel.setTalentCooperationNum(talentBasic.getCooperationNum());
        talentFieldRel.setTalentCompany(talentBasic.getCompany());

        return talentFieldRel;
    }
}
